package com.rankeiot.core.excel;

import ch.rabanti.nanoxlsx4j.Cell;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;

public class DataRowHandler implements Consumer<Row> {
    private Consumer<DataRow> handler;
    public DataRowHandler(Consumer<DataRow> handler){
        this.handler=handler;
    }
    @Override
    public void accept(Row row) {
        DataRow dataRow=new DataRow();
        dataRow.setRowNum(row.getRowNum());
        List<Cell> cells=row.getCells();
        for(Cell c:cells){
            dataRow.put(c.getColumnNumber(),c.getValue());
        }
        handler.accept(dataRow);
    }
}
